namespace CSharpPro._0923;

public class Demo
{
    public void Demo1()
    {
        Console.WriteLine("请输入一个三位数：");
        int num = Convert.ToInt32(Console.ReadLine());
        Console.WriteLine(num/100);
        Console.WriteLine(num%100/10);
        Console.WriteLine(num%10);
    }

    public void Demo2()
    {
        Console.WriteLine("请输入一个年份");
        String str = Console.ReadLine();
        if (!int.TryParse(str, out int num))
        {
            Console.WriteLine("输入错误");
        }
        if ((num % 4 == 0 && num % 100 != 0) || (num % 400 == 0))
        {
            Console.WriteLine(num+"是闰年");
        }
        else
        {
            Console.WriteLine(num+"不是闰年");
        }
    }

    public void Demo3()
    {
        while (true)
        {
            Console.WriteLine("请输入旅游的季节(填月份整数)");
            String str = Console.ReadLine();
            
            if (int.TryParse(str, out int num))
            {
                if (num >= 5 && num <= 10)
                {
                    peakseason();
                }
                else
                {
                    offseason();
                }
                break;
            }
            else
            {
                continue;
            }

        }

        void peakseason()
        {
            while (true)
            {
                Console.WriteLine("请输入选择的出行方式(航班出行或者动车出行)");
                String str = Console.ReadLine();
                switch (str)
                {
                    case "航班出行":
                        Console.WriteLine("您需要付"+8800*0.9+"元");
                        return;
                    case "动车出行":
                        Console.WriteLine("您需要付"+8800*0.75+"元");
                        return;
                    default:
                        break;
                }
            }
            
        }

        void offseason()
        {
            while (true)
            {
                Console.WriteLine("请输入选择的出行方式(航班出行或者动车出行)");
                String str = Console.ReadLine();
                switch (str)
                {
                    case "航班出行":
                        Console.WriteLine("您需要付"+8800*0.6+"元");
                        return;
                    case "动车出行":
                        Console.WriteLine("您需要付"+8800*0.3+"元");
                        return;
                    default:
                        continue;
                }
            }

        }
        
        
    }
    
}